<template>
    <div>
        <div class="tabNav">
            <router-link to="/index">
                <img src="../assets/img/sidebar1.png" />首页
            </router-link>
            <b>/<img src="../assets/img/business.png" />企业信息</b>
            <el-input
                placeholder="请输入企业名称/统一社会信用代码/灵活用工平台名称进行搜索"
                suffix-icon="el-icon-search"
				@change="searchMethods"
                v-model="searchValue">
            </el-input>
            <em><i style="font-size: 16px;margin-right: 5px;" class="el-icon-s-data"></i>企业数量：{{result}}</em>
        </div>
        <el-row :gutter="24">
            <el-col :span="24">
                <el-card class="cardTits cardTitss cardTitdd" shadow="hover">
                    <business-table ref="searchMethods" :search="searchValue"></business-table>
                </el-card>
            </el-col>
        </el-row>
    </div>
</template>

<script>
import BusinessTable from '../components/table/BusinessTable.vue'
export default {
    name: "dashboard",
    data() {
        return {
            name: localStorage.getItem("ms_username"),
            value: '',
            searchValue: '',
            result: 0,
        };
    },
    components: {
		BusinessTable
    },
    computed: {
        role() {
            return this.name === "admin" ? "超级管理员" : "普通用户";
        }
    },
    mounted() {
        this.getinfoData();
    },
    methods: {
		searchMethods() {
			// 搜索
			this.$refs.searchMethods.getTableData()
		},
        getinfoData() {
            // 企业信息数量统计
            this.$http({
                url: '/api/business/selectBusinessBusinessCount',
            method: 'post',
                headers: {
                    'Content-Type': 'application/json'
                }
            }).then(data => {
                if(data.code === 0) {
                    this.result = data.result
                }
            })
        },
    }
};
</script>
